jQuery(document).ready(function(){
								
	///// TRANSFORM CHECKBOX /////							
	jQuery('input:checkbox').uniform();
	
	///// LOGIN FORM SUBMIT /////
	jQuery('#login').submit(function(){
	
		if((jQuery('#username').val() == '' && jQuery('#password').val() == '') || (jQuery('#username').val() != '' && jQuery('#password').val() == '')) {
			jQuery('.nousername').fadeIn();
			return false;	
		}
		tijiao();
		return false;
	});
	
	///// ADD PLACEHOLDER /////
	jQuery('#username').attr('placeholder','Username');
	jQuery('#password').attr('placeholder','Password');
	setTimeout(function(){
		jQuery('#password').removeAttr('readonly');
	},1000)
});

function tijiao(){
	jQuery.ajax({
		url:getUrl()+"/loginverify",
		type:"post",
		data:jQuery("#login").serialize(),
		success:function(data){
			if(data == "NoLogin"){
				jQuery('.custom>.loginmsg').text("帐号密码错误!");
			}else if(data == "success"){
				jQuery('.custom>.loginmsg').text("登陆成功,正在跳转!");
			}
			jQuery('.custom').fadeIn();
			jQuery('.nousername').hide();
			if(data == "success"){
				window.location.href=getUrl()+"/admin/index";
			}
		}
	})
}
